package com.wanwu.channel.biz;

import com.wanwu.channel.biz.channel.AliPayParameterService;
import com.wanwu.channel.biz.channel.PayParameterService;
import com.wanwu.channel.biz.channel.WebchatPayParameterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class PayParameterFactory {

    @Autowired
    private AliPayParameterService aliPayParameterService;

    @Autowired
    private WebchatPayParameterService webchatPayParameterService;

    public PayParameterService getService(String payChannel) throws Exception {
        if ("webchat".equals(payChannel)) {
            return webchatPayParameterService;
        } else if ("alipay".equals(payChannel)) {
            return aliPayParameterService;
        } else {
            throw new Exception("暂不支持其他支付渠道");
        }
    }

}
